//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Drawing;
using System.Windows;
using OpenLS.UI;
using System.Windows.Controls;
namespace  OpenLS.Spreadsheet.UI
{
    partial class PageLayoutTabContent
    {
        public PageLayoutTabContent()
        {
            InitializeComponent();
        }
        void OnThemePreviewChanged(object sender, RoutedEventArgs args)
        {
            Worksheet Worksheet = SpreadsheetElement.GetWorksheet(sender);
            MenuItem menuItem = (MenuItem)sender;
            object preview = HighlightElement.GetHighlightedItem(menuItem);
            if (preview == null)
            {
                Worksheet.Workbook.InPreviewMode = false;
            }
            else
            {
                Worksheet.Workbook.InPreviewMode = true;
                Worksheet.Workbook.Theme = (Theme)preview;
            }
        }
        void OnColorPreviewChanged(object sender, RoutedEventArgs args)
        {
            Range Selection = SpreadsheetElement.GetSelection(sender);
            MenuItem menuItem = (MenuItem)sender;
            object preview = HighlightElement.GetHighlightedItem(menuItem);
            {
                if (preview == null)
                {
                    Selection.Worksheet.Workbook.InPreviewMode = false;
                    return;
                }
                else
                {
                    Selection.Worksheet.Workbook.InPreviewMode = true;
                    Selection.Worksheet.Workbook.Theme.ColorScheme = (ColorScheme)preview;
                }
            }
        }
        void OnFontSchemePreviewChanged(object sender, RoutedEventArgs args)
        {
            Worksheet Worksheet = SpreadsheetElement.GetWorksheet(sender);
            MenuItem menuItem = (MenuItem)sender;
            object preview = HighlightElement.GetHighlightedItem(menuItem);
            {
                if (preview == null)
                {
                    Worksheet.Workbook.InPreviewMode = false;
                    return;
                }
                else
                {
                    Worksheet.Workbook.InPreviewMode = true;
                    Worksheet.Workbook.Theme.FontScheme = (FontScheme)preview;
                }
            }
        }

    }
}